package com.learner.pojo.course;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
* @author ice2020x
* @Date: 2023/2/23
* @Description: 教师的
**/
@Data
@SQLDelete(sql = "update edu_teacher set is_deleted = 1 where id = ?")
@Where(clause = "is_deleted = 0")
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
@Entity
@Table(name = "edu_teacher")
@EntityListeners(AuditingEntityListener.class)
public class Teacher implements Serializable{
    private static final long serialVersionUID = 2904900920094765043L;
    @Id
    @GeneratedValue(generator = "jpa-uuid")
    private String id;

    private String name;

    private String intro;

    private String career;

    private Integer level;

    private String avatar;

    private Integer sort;


    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date joinDate;

    @Column(name = "is_deleted")
    private Boolean deleted = false;

    @CreatedDate
    @Column(name = "gmt_create")
    private Date gmtCreate;

    /**
     * 修改时间
     */
    @LastModifiedDate
    @Column(name = "gmt_modified")
    private Date gmtModified;
}
